package org.gbif.crawler.ws.guice;

import org.gbif.crawler.ws.DatasetProcessService;
import org.gbif.crawler.ws.mock.MockDatasetProcessService;
import org.gbif.service.guice.PrivateServiceModule;

import java.util.Properties;

import com.google.inject.Scopes;

/**
 * A basic class for setting up the injection to enable metrics.
 */
class CrawlerModule extends PrivateServiceModule {

  public static final String PREFIX = "crawler.";


  public CrawlerModule(String propertyPrefix, Properties properties) {
    super(propertyPrefix, properties);
  }

  @Override
  protected void configureService() {
    bind(DatasetProcessService.class).to(MockDatasetProcessService.class).in(Scopes.SINGLETON);
    expose(DatasetProcessService.class);
  }

  public CrawlerModule(Properties properties) {
    super(PREFIX, properties);
  }

// @Provides
// @Singleton
// @Inject
// public CuratorFramework provideZookeperResource(@Named("crawl.server") String url,
// @Named("crawl.namespace") String crawlNamespace, @Named("crawl.server.retryAttempts") Integer retryAttempts,
// @Named("crawl.server.retryDelayMs") Integer retryWait) {
// CuratorFramework client;
// client =
// CuratorFrameworkFactory.builder().connectString(url).namespace(crawlNamespace)
// .retryPolicy(new ExponentialBackoffRetry(retryWait, retryAttempts)).build();
// client.start();
// return client;
// }
}
